Xbasic

NodeServices::NodeMemoryCollectHeap Method

Syntax

L CollectHeap()

Returns

resultLogical

Returns .t. if GC was successfully requested; otherwise .f..

Description

Attempt to force a garbage collection cycle on the Node.js heap.

Discussion

The NodeServices::NodeMemory CollectHeap() method requests a garbage collection cycle. Depending on the runtime and settings, forced GC may not always be permitted; check the returned logical value.

' Request GC, then inspect size before/after
dim nm as NodeServices::NodeMemory

? nm.CollectHeap()
= .T.

? nm.GetHeapSize()
= 3997696